home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 10.9 KB | 292 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Canvas.vu
- #
- # Contains: Quick look test script for Canvas version 3.0.4
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.6> 9/30/93 KTA Initialize gFileName prior to gApptitle being updated by
- # launchTwitch().
- # <1.0.5> 9/28/93 KTA Added returnVal for ModifyDocument hook.
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)()to InitGlobals(ScriptLevel)()
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","UserInterface.Lib","Draw.Lib", "Da.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: ML
- # Description: Sets up tools and fonts for Canvas. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
- global kDrawPaletteNum := 1;
- global kPaintPaletteNum := 2;
-
- global gPaletteList := {
- { #### Start Palette #1 - Draw
- {1,19,50,154,0}, # Location of tab palette relative to the window
- kPalDocWind, # Palette type
- {2,8}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {25,17}, # Offset between tools {h,v}
- 0, # Not used at this time
- 0 # Not used at this time
- }, #### End Palette #1
- { #### Start Palette #2 - Paint
- {1,11,200,28}, # Location of alignment palette relative to the window
- kPalWind, # Palette type
- {8,1}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {25,0}, # Offset between tools {h,v}
- 0, # Not used at this time
- 0 # Not used at this time
- } #### End Palette #2
- };
-
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global SelectTool := { 1, 1, "Select", kClick, 0, {0} };
- global LassoTool := { 2, 1, "Lasso", kClick, 0, {0} };
- global TextTool := { 3, 1, "Text", kClick, 0, {0} };
- global FreeHandTool := { 4, 1, "FreeHand", kDrag, 0, {0} };
- global LineTool := { 5, 1, "Line", kDrag, 0, {0} };
- global PolygonTool := { 6, 1, "Polygon", kMultiClick, 0, {0} };
- global RectangleTool := { 7, 1, "Rectangle", kDrag, 0, {0} };
- global PenTool := { 8, 1, "Pen", kMultiClick, 0, {0} };
- global OvalTool := { 9, 1, "Oval", kDrag, 0, {0} };
- global HandTool := { 10, 1, "Hand", kDrag, 0, {0} };
- global CircleTool := { 11, 1, "Circle", kDrag, 0, {0} };
- global MagnifyTool := { 12, 1, "Magnify", kClick, 0, {0} };
- global CurveTool := { 13, 1, "Curve", kDrag, 0, {0} };
- global CubeTool := { 15, 1, "Cube", kDrag, 1, {0} };
-
-
- global PaintLassoTool := { 1, 2, "Paint Lasso", kClick, 0, {0} };
- global DragSelectTool := { 2, 2, "DragSelect", kDrag, 0, {0} };
- global SprayPaintTool := { 3, 2, "Spray Paint", kDrag, 0, {0} };
- global PaintBrushTool := { 4, 2, "Paint Brush", kDrag, 0, {0} };
- global PaintBucketTool := { 5, 2, "Paint Bucket", kClick, 0, {0} };
- global PencilTool := { 6, 2, "Pencil", kDrag, 0, {0} };
- global EraserTool := { 7, 2, "Eraser", kDrag, 0, {0} };
-
- global DrawToolList:={ SelectTool,
- LassoTool,
- TextTool,
- FreeHandTool,
- LineTool,
- PolygonTool,
- RectangleTool,
- PenTool,
- OvalTool,
- HandTool,
- CircleTool,
- CurveTool
- };
-
- global PaintToolList:={ PaintLassoTool,
- DragSelectTool,
- SprayPaintTool,
- PaintBrushTool,
- PaintBucketTool,
- PencilTool,
- EraserTool
- };
-
- global gToolList:= DrawToolList;
- # PaintToolList not implemented because gVoidRect is rel to window,
- # descriptor for Paint Tools window is global
-
- global gWindowInset := {56,20,20,20};
-
- ### font characteristic lists
- global gFontSizeList := {'6','9','10','12','14','18','24','36','48','72'};
- global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow',
- 'Superscript','Subscript','Small Caps'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- ### Set DoWindows to skip scrolling, scroll bars not recongnized
- global gDoWindowList:= {1,0,1,1};
-
- end; #InitAppGlobals
-
- #########################################################################
- # Views()
- #========================================================================
- # Author: ML
- # Description: Change views.
- # Parameters: None
- # Returns: Nothing
- # Examples: Views();
- # Assumptions: None
- # Applications: Canvas
- #========================================================================
- # History:
- #
- #########################################################################
- task Views() begin
- LogStr( "Changing Views in Canvas");
- selectMenuItem('Reduce to Fit','Views','Layout');
- selectMenuItem('Home View','Views','Layout');
- selectMenuItem('Zoom In','Views','Layout');
- selectMenuItem('Zoom Out','Views','Layout');
- end;
-
- #########################################################################
- # CanvasScroll()
- #========================================================================
- # Author: ML
- # Description: Scroll vertically and horizontally, and return
- # Parameters: None
- # Returns: Nothing
- # Examples: CanvaScroll();
- # Assumptions: None
- # Applications: Canvas
- #========================================================================
- # History:
- #
- #########################################################################
- task CanvasScroll()
- begin
- match[window o:1 s:document c:true z:true g:true r:?ScreenDim];
- WindowRight:= ScreenDim[3];
- WindowBottom:= ScreenDim[4];
- HRightScrollButton:= (WindowRight-10);
- VRightScrollButtonBegin:= 65;
- VRightScrollButtonEnd:= (WindowBottom-40);
- VBottomScrollButton:= (WindowBottom-10);
- HBottomScrollButtonBegin:= 297;
- HBottomScrollButtonEnd:= WindowRight-40;
-
- LogStr("Scroll the window vertically using absolute coordinates");
- MoveMouse(HRightScrollButton,VRightScrollButtonBegin);
- MoveMouse(HRightScrollButton,VRightScrollButtonEnd,,1);
-
- LogStr("Scroll the window horizontally using absolute coordinates");
- MoveMouse(HBottomScrollButtonBegin,VBottomScrollButton);
- MoveMouse(HBottomScrollButtonEnd,VBottomScrollButton,,1);
-
- LogStr("Scroll back to original vertical position");
- MoveMouse(HRightScrollButton,VRightScrollButtonEnd);
- MoveMouse(HRightScrollButton,VRightScrollButtonBegin,,1);
-
- LogStr("Scroll back to original horizontal position");
- MoveMouse(HBottomScrollButtonEnd,VBottomScrollButton);
- MoveMouse(HBottomScrollButtonBegin,VBottomScrollButton,,1);
- end;
-
-
- #########################################################################
- # CanvasModifyDocument()
- #========================================================================
- # Author: ML
- # Description: Modify Canvas Document
- # Parameters: None
- # Returns: Nothing
- # Examples: CanvasModifyDocument();
- # Assumptions: None
- # Applications: Canvas
- #========================================================================
- # History:
- #
- #########################################################################
- task CanvasModifyDocument()
- begin
- theReturn := Scrapbook(global kScrapTEXT);
- select [menu t:'File']; # to enable menu items that VU thinks are disabled
- return(theReturn);
- end;
-
- #########################################################################
- # CanvasSetupDoText()
- #========================================================================
- # Author: ML
- # Description: Setup document for DoText()
- # Parameters: None
- # Returns: Nothing
- # Examples: CanvasSetupDoText();
- # Assumptions: None
- # Applications: Canvas
- #========================================================================
- # History:
- #
- #########################################################################
- task CanvasSetupDoText()
- begin
- logstr("Setting up for DoText()");
- Draw(global TextTool);
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script Canvas (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel); # initialize your general globals
- InitDraw();
- InitFonts();
- global gAppTitle := 'Canvas'; # Title of app you will be running
- global gAppVersion := '3.0.3'; # version of app you will be running
- global gFileName := "@!@-{gBuildVers}-{gAppTitle}"; # This is used in SaveAs when saving files
- SuiteStart('Canvas.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gModifyDocument:= task CanvasModifyDocument; # define app specific task
- global gSetupDoText:= task CanvasSetupDoText; # define app specific task
- InitAppGlobals(); # init app specific globals
- (*
- *)
- DialogCheck('You have exceeded the user limit.',1); # Check for Serial number dialog will work with 3.0.3
- DoSetUpApp('No Tools',,,,1,1);
- DoText();
- DoDraw();
- Views();
- CanvasScroll();
- DoWindow();
- select [menu t:'File']; # to enable menu items that VU thinks are disabled
- DoCloseApp(1);
- logstr("Oh-Oh Toto, I don't think we're in Canvas anymore!");
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script Canvas